import service from '@/utils/crmRequest'

export default () => ({
  // 潜在代理商---创建
  POTENTIALAGENT_CREATE: (data,id = 0) => {
    return service({
      url: '/api/agent/create?id=' + id,
      method: 'post',
      data
    })
  },
  POTENTIALAGENT_CREATE_FROM: (data) => {
    return service({
      url: `/api/agent/create?from=1`,
      method: 'post',
      data
    })
  },
  POTENTIALAGENT_CREATE_UPDATE: (data) => {
    return service({
      url: `/api/agent/update?from=1`,
      method: 'PUT',
      data
    })
  },

  // 潜在代理商---更新
  POTENTIALAGENT_UPDATE: (data) => {
    return service({
      url: '/api/agent/update',
      method: 'put',
      data
    })
  },


   // 潜在代理商---更新
   POTENTIALAGENT_CHANGE: (data) => {
    return service({
      url: '/api/agent/change',
      method: 'put',
      data
    })
  },

  POTENTIALAGENT_UPDATE_FROM: (data) => {
    return service({
      url: `/api/agent/update?from=1`,
      method: 'put',
      data
    })
  },

  // 潜在代理商---意向产品添加
  POTENTIALAGENT_PRODUCT: (keyWord) => {
    return service({
      url: `/api/product/getList?keyWord=${keyWord}&from=1`,
      method: 'get',
    })
  },

  // 潜在代理商---列表
  POTENTIALAGENT_LIST: (data) => {
    return service({
      url: '/api/agent/list',
      method: 'post',
      data
    })
  },

  // 潜在代理商---列表删除
  POTENTIALAGENT_DELETE_LIST: (id) => {
    return service({
      url: `/api/agent/delete?id=${id}`,
      method: 'DELETE',
    })
  },

  // 潜在代理商---详情
  POTENTIALAGENT_DETAIL: (id) => {
    return service({
      url: `/api/agent/detail?id=${id}`,
      method: 'get',
    })
  },

  // 潜在代理商---合同详情
  POTENTIALAGENT_CONTRACT_DETAIL: (id) => {
    return service({
      url: `/api/contract/last?id=${id}`,
      method: 'get',
    })
  },

  // 潜在代理商---名字是否重复
  POTENTIALAGENT_NAME: (params) => {
    return service({
      url: '/api/common/check-unique',
      method: 'get',
      params
    })
  },

  // 签约代理商---开户
  POTENTIALAGENT_OPEN_ACCOUNT: (data) => {
    return service({
      url: '/api/agent/open-account',
      method: 'post',
      data
    })
  },

  //* *************************************************************************

  // 兼职大包---列表
  PARTTIMEBIGBAG_LIST: (data) => {
    return service({
      url: '/api/agent/person/list',
      method: 'post',
      data
    })
  },

  // 兼职大包---新建
  PARTTIMEBIGBAG_CREATE: (data) => {
    return service({
      url: '/api/agent/person/create',
      method: 'post',
      data
    })
  },

  //* ********************开发中终端*****************************************************
  // 兼职大包---列表
  PARTTIMEBIGBAG_TERMINAL_CREATE: (data) => {
    return service({
      url: '/api/dev/list-for-agent',
      method: 'post',
      data
    })
  },

  // 获取有效合同
  CONTRACT_EFFECTIVE: (data) => {
    return service({
      url: '/api/contract/list-in-use',
      method: 'post',
      data
    })
  },

  // 获取有效合同
  QUALIFICATION_CREATE: (data, val) => {
    return service({
      url: `/api/agent/qualification/${val}`,
      method: 'post',
      data
    })
  },

  //跟进记录
  QUALIFICATION_LISTTYPE: (data) => {
    return service({
      url: `/api/followUp/list-type`,
      method: 'post',
      data
    })
  },

})
